<?php
require_once BACKGROUND_COMMON_ACTION_SERVICE_DIR . '/default.php';

class background_good_add_form_action_service extends background_default_common_action_service
{
    protected static $_instance;
    
    protected $_uploadify_key = '';

    public static function get_instance()
    {
        if (null === self::$_instance) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }

    protected function _current_page_process()
    {
        //var_dump(__METHOD__); exit();
        
        $good_info = array();
        
        $model_background_good_category = wwy_resource_container::get_model_background_good_category();
        $all_category_list = $model_background_good_category->get_all_category_list();
        
        $timestamp = time();    //上传图片验证的时间戳
        $uploadify_key = wwy_resource_container::get_config_item('uploadify_key');
        $token = md5($timestamp . $uploadify_key);   //上传图片验证的令牌
         
        //控制是否引用【uploadify】、【ueditor】相关
        $if_good_info = 1;
         
        self::add_view_data('good_info', $good_info);
        self::add_view_data('all_category_list', $all_category_list);
        self::add_view_data('timestamp', $timestamp);
        self::add_view_data('token', $token);
        self::add_view_data('if_good_info', $if_good_info);
    }
}